// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-11-16

#ifndef __DB_SOURCE_H_COMMON_SVR_BASE__
#define __DB_SOURCE_H_COMMON_SVR_BASE__

#pragma once


namespace JoyServer
{
#define JOY_USE_DB_CONNECTION

class CJoyDbSource :
#ifdef JOY_USE_DB_CONNECTION
    public CDataConnection
#else
    public CDataSource
#endif
{
public:
    CString m_initString;
public:
    CJoyDbSource();
    virtual ~CJoyDbSource();

    HRESULT Open(PCSTR pszInitStr);
    void Close();

    bool IsOpened()
    {
#ifdef JOY_USE_DB_CONNECTION
        return __super::m_source.m_spInit != NULL;
#else
        return m_spInit != NULL;
#endif
    }
};

} // namespace JoyServer

#endif  // __DB_SOURCE_H_COMMON_SVR_BASE__